package ciyuan.ChangeMinecraft;

import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

/**
 * @author 150149
 */
@Mod.EventBusSubscriber
public class NoUseTeleportDoor {

    @SubscribeEvent
    public static void onRightClick(PlayerInteractEvent event) {
        if (!event.getPlayer().getItemInHand(event.getHand()).getItem().getRegistryName().getPath().toLowerCase().contains("flint_and_steel") && !event.getPlayer().getItemInHand(event.getHand()).getItem().getRegistryName().getPath().toLowerCase().contains("ender_eye")) {
            return;
        }

        if (event.getWorld().getBlockState(event.getPos()).getBlock().getRegistryName().getPath().toLowerCase().contains("obsidian")) {
            event.setCanceled(true);
        }
        if (event.getWorld().getBlockState(event.getPos()).getBlock().getRegistryName().getPath().toLowerCase().contains("end_portal_frame")) {
            event.setCanceled(true);
        }
    }

}
